Repository navigation
be: let a bank account carry its country and read or write its iban - #46
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Slovak banks write accounts as IBANs, and a Czech and a Slovak account can share digits and a bank code, which
BankAccountcould not tell apart. Groundwork for ČSOB SK and Tatra banka.country(),CountryCZorSK, an enum of its own, first in the record; part of equality, so the same digits in two countries are two accounts.parse(text, country)reads a local form. There is no default country: a local form does not say it, and a default would quietly read a Slovak account as Czech. The one-argumentparseis gone; every call, in the parsers, tests and the Spring Boot caller test, now namesCZ(58 calls).parseIban(text), with or without spaces, checks ISO 13616's modulo 97 and then the same modulo 11 rule as the local form; only CZ and SK.iban()writes it back; a local form and its IBAN compare equal.Breaking, fine before 1.0:
BankAccountgains a component and losesparse(String).Tests: the ČNB sample account both ways, the Slovak IBAN, round trip, two countries apart, bad check digits, a modulo 11 failure behind valid check digits, a German IBAN. They caught one real bug on the way: the IBAN's parts were first passed in IBAN order (bank code first) to a constructor that takes the prefix first. Breaking the modulo 97 or the modulo 11 check each fails a test.
make build: green.